package cn.edu.nju.contact.view;

import cn.edu.nju.contact.R;
import cn.edu.nju.contact.add.ContactAddActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;

public class ContactViewActivity extends Activity {

	TextView textView_title;
	TextView textView_name;
	TextView textView_phone_num;
	
	Button edit_button;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.contact_view);
		
		Intent intent = getIntent();
		
		textView_title = (TextView)findViewById(R.id.textView_contact_view_title);
		textView_title.setText(getText(R.string.contact_view));
		
		textView_name = (TextView)findViewById(R.id.textView_contact_item_name);
		textView_name.setText(intent.getStringExtra("name"));
		
		textView_phone_num = (TextView)findViewById(R.id.textView_contact_view_phone);
		textView_phone_num.setText(intent.getStringExtra("phone_num"));
		
		edit_button = (Button)findViewById(R.id.button_edit_contact);
		edit_button.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				Intent intent = new Intent(ContactViewActivity.this, ContactAddActivity.class);
				startActivity(intent);
			}
		});
	}

}
